#!./perl
#req_more_info.pl

# ------------------------------------------------------------
# render dynamic page 

# parse disc name from ServerName Environt Variable with this script

do './variables.pl';


	

# get args

while (@ARGV) {
$ARGV=shift;
$from = $ARGV;
$ARGV=shift;
$from_email = $ARGV;
}


# check to see if it is a fax, then make changes

if ($from_email !~ /[@!]/ ) {
	$fax = "FAX this:$from_email";
	$from_email = "marc.sacoolas\@sun.com";
	}

 
# see if info has already been filled out 
# if so, skip form
 
if ( -e </tmp/httpd/info.*> ) { 

if ( -e "/tmp/httpd/info.email" ) { 

    open (FILE, ">>/tmp/httpd/info.email");
    } else {
    open (FILE, ">>/tmp/httpd/info.fax");
    }


    print FILE "$from\n"; 
close (FILE);

    print "Content-type: text/html\n\n"; 
    print "<html><head>\n";
    print "<title>Information Request Acknowledgement</title>\n";
    print "</head>\n<body>\n";
    print "<applet code=delay.class width=596 height=75>";
    print "<param name=img value=\"file:///tmp/httpd/.products/$disc_name/images/goto_home.gif\">";
    print "<param name=del value=\"2200\">";
    print "<param name=href value=\"file:///tmp/httpd/.products/$from/$disc_name.frame.html\"></applet>";
    print "<p><p><center><hr>";
    print "<p><h1>Your request for more information</h1>";
    print "<h1>from this company has been made.</h1>";
    print "<hr><H2>It will be E-mailed/Printed out when you end your $disc_name session.</h2></center>";
#    &html_trailer;

exit 0;
} 
sub html_header {

    local($title) = @_;

    print "Content-type: text/html\n\n";
    print "<html><head>\n";
    print "<title>$title</title>\n";
    print "</head>\n<body>\n";
}

sub html_trailer {

    # subroutine html_trailer sends the trailing material to the HTML
    # on STDOUT.

    local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
	= gmtime;

    local($mname) = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
		     "Aug", "Sep", "Oct", "Nov", "Dec")[$mon];
    local($dname) = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri",
		     "Sat")[$wday]; 

    print "<p>\nGenerated by: <var>$0</var><br>\n";
    print "Date: $hour:$min:$sec UT on $dname $mday $mname $year.<p>\n";
    print "</body></html>\n";
}




    &html_header('More Information Request Form');
    print "<FORM METHOD=\"POST\" ACTION=\"http://localhost:7999/cgi-bin/more_info.pl\">\n";
    #print "<FORM METHOD=\"POST\" ACTION=\"http://sun-www.ebay/cgi-bin/generic_mailer2.pl\">\n";
    print "<INPUT NAME=\"mailto\" TYPE=\"hidden\" VALUE=\"$from_email\">\n";
    print "<INPUT NAME=\"from\" TYPE=\"hidden\" VALUE=\"$from\">\n";
    print "<INPUT NAME=\"request\" TYPE=\"hidden\" VALUE=\"$fax More information Request\">\n";
    print "<INPUT NAME=\"thanks_url\" TYPE=\"hidden\" VALUE=\"http://localhost:7999/$disc_name/docs/thanks.html\">\n";
    print "        Take a minute to fill out this form, and every subsequent request for more information will automatically use this.  If you do not have out going e-mail ability, please use the numbered card in the $disc_name case.\n";
    print "<pre>"; 
    print "<hr>"; 
    print "<p>";
    print "<B>Name    </B><input type=\"text\" size=20 name=\"REQUIRED Name\">";    
    print "<B>    Title </B><input type=\"text\" size=21 name=\"REQUIREDTitle\">\n";    
    print "<B>Company </B><input type=\"text\" size=20 name=\"REQUIRED Company\">\n";    
    print "<B>Address </B><input type=\"text\" size=52 name=\"REQUIRED Adress\">\n";    
    print "<B>City    </B><input type=\"text\" size=30 name=\"REQUIRED City\">\n";
    print "<B>State   </B><input type=\"text\" size=11 name=\"REQUIRED State\">";
    print "<B> Zip </B><input type=\"text\" size=8 name=\"REQUIRED Zip\">  ";
#    print "<B>City, Zip, State </B><input type=\"text\" size=30 name=\"REQUIRED City,Zip,Sate\">";
    print "<B>Country </B><input type=\"text\" size=16 name=\"Country\">\n";    
    print "<B>E-mail Address           </B><input type=\"text\" size=35 name=\"Email\">\n";    
    print "<B>Telephone Number         </B><input type=\"text\" size=20 name=\"Telephone\">\n";
    print "<B>Fax                      </B><input type=\"text\" size=20 name=\"Fax\">";    
    print "<p>";
    print "<hr>";
    print "<input type=\"checkbox\" name=\"release\" value=\"Please add\"><i>Please add my name to your mailing list.\n";
    print "<p>";
    print "<input type=\"checkbox\" name=\"add\" value=\"Please do not\"><i>Please do not release my name to other Sun-authorized organizations.\n";
    print " <INPUT TYPE=\"radio\" NAME=\"submit\" VALUE=\"email\" checked> <B>E-mail Request</B> <INPUT TYPE=\"radio\" NAME=\"submit\" VALUE=\"fax\" > <B>Print Request for faxing</B>\n";
    print "</pre>";
    print "<hr>";
    print "                  <INPUT TYPE=\"submit\" VALUE=\"Submit $disc_name Reply Card\">\n";
    print '</form>'; 
    &html_trailer;
    exit 0;


